package day0210;

import java.util.Scanner;

//猜数字的小案例：
//1.生成一个随机数
//2.循环输入答案
public class Test1 {
    public static void main(String[] args) {
        //1.生成随机数
        int num1=(int)(Math.random()*100);
        Scanner in = new Scanner(System.in);
        //2.循环输入答案
        for (int i = 0; i <10 ; i++) {
            System.out.println("请输入你猜的数：");
            int num2= in.nextInt();//输入num2
            if(num1>num2){
                System.out.println("猜小了");
            }else if(num1<num2){
                System.out.println("猜大了");
            }else{
                System.out.println("猜对了");
                break;
            }
        }

    }
}
